﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Twitter;

namespace FriendsNearbyBot
{
    internal class DefaultProcessor : IMessageProcessor
    {
        IMessageBuilder messageBuilder;

        public DefaultProcessor()
            : this(new PlainTextMessageBuilder())
        {

        }

        public DefaultProcessor(IMessageBuilder messageBuilder)
        {
            this.messageBuilder = messageBuilder;
        }

        public bool CanProcess(Message message)
        {
            return true;
        }

        public RunNextProcessor Process(IBotClient client, Message message)
        {
            string command = message.Text;
            messageBuilder.Clear();
            messageBuilder.AppendFragment(string.Format(Properties.Resources.InvalidCommand, command));
            client.SendMessages(message.Sender.ScreenName, messageBuilder.GetMessages(), message, this.GetType().Name);
            BotProcessor.MessageProcessed(client, message);
            return RunNextProcessor.No;
        }
    }
}
